From efb8e0c63f3d394ac37bfeaf3c27cc092d06317f Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 24 Nov 2005 11:17:20 +0100 Subject: [PATCH] This fixes a small race between when a domain is created and when xentop tries to read it's info from the xenstore. Instead of sending a NULL pointer for the name the name will be displayed as a ' ' until the next refresh where xentop will then properly display the name. Signed-off-by: Jerone Young Signed-off-by: Anthony Liguori --- tools/xenstat/libxenstat/src/xenstat.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tools/xenstat/libxenstat/src/xenstat.c b/tools/xenstat/libxenstat/src/xenstat.c index e01ee8c4eb..921c7d29db 100644 --- a/tools/xenstat/libxenstat/src/xenstat.c +++ b/tools/xenstat/libxenstat/src/xenstat.c @@ -702,19 +702,12 @@ static char *xenstat_get_domain_name(xenstat_handle *handle, unsigned int domain { char path[80]; char *name; - struct xs_transaction_handle *xstranshandle; snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id); - xstranshandle = xs_transaction_start(handle->xshandle); - if (xstranshandle == NULL) { - perror("Unable to get transcation handle from xenstore\n"); - exit(1); /* Change this */ - } - - name = (char *) xs_read(handle->xshandle, xstranshandle, path, NULL); - - xs_transaction_end(handle->xshandle, xstranshandle, false); + name = xs_read(handle->xshandle, NULL, path, NULL); + if (name == NULL) + name = strdup(" "); return name; } -- 2.30.2